﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace MapadeLuzesnoChao
{
    class cameraManager
    {

        public static List<camera> cameras = new List<camera>();
        public static camera currentCamera;

        public cameraManager()
        {

        }



        /// <summary>
        /// Método pra pegar próxima câmera
        /// </summary>
        /// <returns></returns>
        private camera getNextCamera()
        {

            for (int i = 0; i < cameras.Count; i++) // Loop through List with for
            {
                if (cameras[i].Equals(currentCamera))
                {
                    if (i < (cameras.Count - 1))
                    {
                        return cameras[i + 1];
                    }
                    else
                    {
                        return cameras[0];
                    }
                }
            }

            return cameras[0];
        }




        public void Update(KeyboardState keyboard, KeyboardState old_keyboard)
        {

            //Checa mudança de câmeras
            if (keyboard.IsKeyDown(Keys.Tab) && !old_keyboard.IsKeyDown(Keys.Tab))
            {
                currentCamera = getNextCamera();
            }

        }

    }
}
